package org.example.booksmanagementsystem.redissync;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Slf4j
@Service
public class DataInitService implements InitializingBean {

    @Autowired
    private DataSyncService dataSyncService;

    @Override
    public void afterPropertiesSet() throws Exception {
        // 应用初始化完成后执行
        log.info("InitializingBean触发数据同步...");
        dataSyncService.syncMysqlToRedis();
    }
}
